<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 接口地址：http://jx.xuzhixiang.top/ap/api/productlist.php
        //          接口请求方式：get
        //          接口参数：
        //               无需参数（不登录也能看到商品列表）
        //                uid 可选参数，可以看到当前用户上传到服务器的商品
        //          使用方式
        //     http://jx.xuzhixiang.top/ap/api/productlist.php

        let middleshop = document.querySelector("#shop-1");
        let middleshop2 = document.querySelector("#shop-2");
        let middleshop3 = document.querySelector("#shop-3");
        let middleshop4 = document.querySelector("#shop-4");
        let middleshop5 = document.querySelector("#shop-5");
        let middleshop6 = document.querySelector("#shop-6");

        window.onload = function () {
            let shopapi = "http://jx.xuzhixiang.top/ap/api/productlist.php"
            let uid = localStorage.getItem("id");
            console.log(uid);
            axios.get(shopapi, {
                    params: {
                        uid
                    }
                })
                .then((r) => {
                    let rr = r.data.data;
                    console.log(rr);
                    let ahtml = rr.map((v) =>

                        ` <div id="wwd">
                        < a href=" ">
                                < img src="${v.pimg}" alt="">
                                    <p>${v.pname}</p>
                                    <p>${v.pdesc}</p>
                                    <b>${v.pprice}</b>
                                 </ a>  </div> `
                    ).join("")


                    middleshop.innerHTML = ahtml
                    middleshop2.innerHTML = ahtml
                    middleshop3.innerHTML = ahtml
                    middleshop4.innerHTML = ahtml
                    middleshop5.innerHTML = ahtml
                    middleshop6.innerHTML = ahtml

                })
        }
    </script>
</body>

</html>